package com.yserp.project.erp.store.instorelog.service.impl;

import com.yserp.common.utils.DateUtils;
import com.yserp.common.utils.text.Convert;
import com.yserp.project.erp.store.instorelog.domain.StockInLog;
import com.yserp.project.erp.store.instorelog.mapper.StockInLogMapper;
import com.yserp.project.erp.store.instorelog.service.IStockInLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 入库日志Service业务层处理
 * 
 * @author yserp
 * @date 2022-07-08
 */
@Service
public class StockInLogServiceImpl implements IStockInLogService 
{
    @Resource
    private StockInLogMapper stockInLogMapper;

    /**
     * 查询入库日志
     * 
     * @param id 入库日志主键
     * @return 入库日志
     */
    @Override
    public StockInLog selectStockInLogById(Long id)
    {
        return stockInLogMapper.selectStockInLogById(id);
    }

    /**
     * 查询入库日志列表
     * 
     * @param stockInLog 入库日志
     * @return 入库日志
     */
    @Override
    public List<StockInLog> selectStockInLogList(StockInLog stockInLog)
    {
        return stockInLogMapper.selectStockInLogList(stockInLog);
    }

    /**
     * 新增入库日志
     * 
     * @param stockInLog 入库日志
     * @return 结果
     */
    @Override
    public int insertStockInLog(StockInLog stockInLog)
    {
        stockInLog.setCreateTime(DateUtils.getNowDate());
        return stockInLogMapper.insertStockInLog(stockInLog);
    }

    /**
     * 修改入库日志
     * 
     * @param stockInLog 入库日志
     * @return 结果
     */
    @Override
    public int updateStockInLog(StockInLog stockInLog)
    {
        stockInLog.setUpdateTime(DateUtils.getNowDate());
        return stockInLogMapper.updateStockInLog(stockInLog);
    }

    /**
     * 批量删除入库日志
     * 
     * @param ids 需要删除的入库日志主键
     * @return 结果
     */
    @Override
    public int deleteStockInLogByIds(String ids)
    {
        return stockInLogMapper.deleteStockInLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除入库日志信息
     * 
     * @param id 入库日志主键
     * @return 结果
     */
    @Override
    public int deleteStockInLogById(Long id)
    {
        return stockInLogMapper.deleteStockInLogById(id);
    }
}
